package com.anhtuan.reminder;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class NotificationDetailActivity extends Activity implements OnClickListener {
	
	public static Uri ALERT_MSG = Uri.parse("intent://alertmsg");
	public static String ALERT_MSG_KEY = "alertmsg";
	
	public static Uri SMS_BODY = Uri.parse("intent://smsbody");
	public static String SMS_BODY_KEY = "smsbody";
	
	private EditText editText;
	private Button buttonBack;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.notificationdetail);
		
		editText = (EditText) findViewById(R.id.editText);
		buttonBack = (Button) findViewById(R.id.buttonBack);
		
		Uri data = getIntent().getData();
		
		String content = "";
		
		if (data.equals(ALERT_MSG)) {
			content = getIntent().getExtras().getString(ALERT_MSG_KEY);
		} else if (data.equals(SMS_BODY)) {
			content = getIntent().getExtras().getString(SMS_BODY_KEY);
		}
		
		editText.setText(content);
		buttonBack.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		if (v.getId() == R.id.buttonBack) {
			finish();
		}
	}
}
